package com.heima.article.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.heima.article.dto.CollectionBehaviorDto;
import com.heima.article.feign.ApBehaviorEntryFeign;
import com.heima.common.dto.ResponseResult;
import com.heima.common.dto.User;
import com.heima.common.util.AppThreadLocalUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.article.service.IApCollectionService;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP收藏信息表 前端控制器
 * </p>
 *
 * @author mcm
 * @since 2022-01-19
 */
@RestController
@RequestMapping("/api/v1/article/collection/")
@Api(tags = "APP收藏信息表接口")
public class ApCollectionController {

    @Autowired
    private IApCollectionService apCollectionService;

    @PostMapping
    public ResponseResult getCollection(@RequestBody CollectionBehaviorDto dto) {
        //1 dto操作类型为0，代表收藏
        if (dto.getOperation() == 0) {

            return apCollectionService.getCollection(dto);
        }
        //2 取消收藏
        if (dto.getOperation() == 1) {

            return apCollectionService.delelteCollection(dto);
        }
        return null;
    }
}
